package com.etms.utils;

import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Timer;
import java.util.concurrent.TimeUnit;

//时间转化工具类
public class DateUtils {
    private static String dateTime;

    private static long timeMills;

    public static String getDateTime(Date date) {

        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        dateTime =sdf.format(date);

        return dateTime;
    }

    public static long getTimeMills(Date date) {
        timeMills=date.getTime();
        return timeMills;
    }

    public static void main(String[] args) {
        int day = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
        int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
        int dayOf = Calendar.getInstance().get(Calendar.DAY_OF_YEAR);
        System.out.println(dayOf);
    }
}
